package com.esri.core.tasks.ags.geoprocessing;

import com.esri.core.geometry.Envelope;
import com.esri.core.geometry.GeometryEngine;
import com.esri.core.geometry.MapGeometry;
import com.esri.core.geometry.SpatialReference;
import com.esri.core.internal.util.d;
import com.esri.core.io.EsriServiceException;
import java.net.URL;
import org.codehaus.jackson.JsonNode;
import org.codehaus.jackson.JsonParser;
import org.codehaus.jackson.JsonToken;

/* loaded from: classes.dex */
public class GPMapImage {
    private Envelope extent;
    private int height;
    private URL href;
    private double scale;
    private SpatialReference spatialRef;
    private int width;

    public URL getHref() {
        return this.href;
    }

    public int getWidth() {
        return this.width;
    }

    public int getHeight() {
        return this.height;
    }

    public Envelope getExtent() {
        return this.extent;
    }

    public SpatialReference getSpatialReference() {
        return this.spatialRef;
    }

    public double getScale() {
        return this.scale;
    }

    public void setHref(URL url) {
        this.href = url;
    }

    public void setWidth(int i) {
        this.width = i;
    }

    public void setHeight(int i) {
        this.height = i;
    }

    public void setExtent(Envelope envelope) {
        this.extent = envelope;
    }

    public void setScale(double d) {
        this.scale = d;
    }

    public void fromJson(JsonParser jsonParser) throws Exception {
        if (!d.c(jsonParser)) {
            throw new EsriServiceException("Unable to parse the Response for this GPMapImage.");
        }
        while (jsonParser.nextToken() != JsonToken.END_OBJECT) {
            String currentName = jsonParser.getCurrentName();
            jsonParser.nextToken();
            if ("href".equals(currentName)) {
                this.href = new URL(jsonParser.getText());
            } else if ("width".equals(currentName)) {
                this.width = jsonParser.getIntValue();
            } else if ("height".equals(currentName)) {
                this.height = jsonParser.getIntValue();
            } else if ("extent".equals(currentName)) {
                MapGeometry jsonToGeometry = GeometryEngine.jsonToGeometry(jsonParser);
                this.extent = (Envelope) jsonToGeometry.getGeometry();
                this.spatialRef = jsonToGeometry.getSpatialReference();
            } else if ("scale".equals(currentName)) {
                this.scale = Double.parseDouble(jsonParser.getText());
            } else {
                jsonParser.skipChildren();
            }
        }
    }

    public void fromJson(JsonNode jsonNode) throws Exception {
        JsonNode jsonNode2 = jsonNode.get("href");
        if (jsonNode2 != null) {
            this.href = new URL(jsonNode2.getTextValue());
        }
        JsonNode jsonNode3 = jsonNode.get("width");
        if (jsonNode3 != null) {
            this.width = jsonNode3.getIntValue();
        }
        JsonNode jsonNode4 = jsonNode.get("height");
        if (jsonNode4 != null) {
            this.height = jsonNode4.getIntValue();
        }
        jsonNode.get("extent");
        JsonNode jsonNode5 = jsonNode.get("scale");
        if (jsonNode5 != null) {
            this.scale = jsonNode5.getDoubleValue();
        }
    }

    public int hashCode() {
        Envelope envelope = this.extent;
        int hashCode = ((((envelope == null ? 0 : envelope.hashCode()) + 31) * 31) + this.height) * 31;
        URL url = this.href;
        int hashCode2 = url != null ? url.hashCode() : 0;
        long doubleToLongBits = Double.doubleToLongBits(this.scale);
        return ((((hashCode + hashCode2) * 31) + ((int) (doubleToLongBits ^ (doubleToLongBits >>> 32)))) * 31) + this.width;
    }

    public boolean equals(Object obj) {
        if (this == obj) {
            return true;
        }
        if (obj != null && getClass() == obj.getClass()) {
            GPMapImage gPMapImage = (GPMapImage) obj;
            Envelope envelope = this.extent;
            if (envelope == null) {
                if (gPMapImage.extent != null) {
                    return false;
                }
            } else if (!envelope.equals(gPMapImage.extent)) {
                return false;
            }
            if (this.height != gPMapImage.height) {
                return false;
            }
            URL url = this.href;
            if (url == null) {
                if (gPMapImage.href != null) {
                    return false;
                }
            } else if (!url.equals(gPMapImage.href)) {
                return false;
            }
            return Double.doubleToLongBits(this.scale) == Double.doubleToLongBits(gPMapImage.scale) && this.width == gPMapImage.width;
        }
        return false;
    }
}
